
$(function () {
    var oWebControl;
    var fontSize = $$.fitFontSize(16);
    var plynDatas; //行政区划
    var plyn, marker;
    var mapPlyns=[],mouseLnglat;//地图区块数组
    var mapAreaCode = '330000'; //区划关键点
    var commonYear = (new Date()).getFullYear();
    var isMapScale = false;
    var isMapClick = false;
    var mapLastZoom;
    var pxryTimer=null;
    var scrollTimer=null;
    var fh_btn=false;//tab点击切换
    $('[page-href]').click(function(){
        var src = $(this).attr('page-href');
        window.parent.changeMainPage(src);
    })
    console.log($$.localName("areaCode"),"$$.localName")
    if($$.localName("areaCode")){
        mapAreaCode =getAreaCode($$.localName("areaCode"))
        $('.map_tit').append('<span  data-i="'+ mapAreaCode+'"    class="loc" >  '+$$.localName("areaText")+'</span>')
     }
    //地图指标类型
    var mapTypes = {
        main:[
            {name:'在办案件',value:'zbajs'},
            {name:'双随机检查次数',value:'ssjsjccs'}
        ],
      
    };
    var mapLevelSelects = {
        main_zbajs:[
            { gt: 50,class:'red'},
            { lt: 50,gt:20,class:'yellow'},
            { lt: 20,class:'green'},
        ],
        main_ssjsjccs:[
            { gt: 100,class:'green'},
            { lt: 100,gt:10,class:'yellow'},
            { lt: 10,class:'red'},
        ],
       
    }
  
    var mapColor = {
        normal: 'rgba(56,108,161,0.60)',
        active:'rgba(89,147,212,1)'
    }
    $(".model_tab span").on('click',function(){
        $(this).addClass('active').siblings().removeClass('active');
        var type= $(this).attr('data-type');
         if(type =="month"){
            getjgajfssmonth()
         }else if(type =="year"){
            getjgajfssyear()
         }else if(type=="laq"){
            getajclqk()
         }else if(type=="lah"){
            getajclqk1()
         }else if(type=="gkay"){
            getajgk()
         }else if(type=="gkay2"){
            getajgk1()
         }
    })
    //所属管辖
    var areaDatas = [
        { label:'浙江省',value:'330000'},
        { label:'杭州市',value:'330100'},
        { label:'宁波市',value:'330200'},
        { label:'温州市',value:'330300'},
        { label:'嘉兴市',value:'330400'},
        { label:'湖州市',value:'330500'},
        { label:'绍兴市',value:'330600'},
        { label:'金华市',value:'330700'},
        { label:'衢州市',value:'330800'},
        { label:'舟山市',value:'330900'},
        { label:'台州市',value:'331000'},
        { label:'丽水市',value:'331100'},
        
    ],areaSelects=[];
    var sjgjPageTimer = null;
    var myGDMap = new AMap.Map('map', {
        resizeEnable: true,
        rotateEnable: true,
        pitchEnable: true,
        zoom: 7,
        pitch: 45,
        // mapStyle: "amap://styles/dark",
        // mapStyle:'amap://styles/1c4fb1696d4e7344252ebc6334365e0c',
        mapStyle:'amap://styles/2b4440833495a1a629cd5595fec460c2',
        rotation: 0,
        // viewMode:'3D',//开启3D视图,默认为关闭
        buildingAnimation: true, //楼块出现是否带动画
        expandZoomRange: true,
        center:[120.153576,29.289523],
        zooms: [7, 20],

    });
    var mapActiveAreaData = {};
    // AMap.plugin([
    //     'AMap.ToolBar',
    // ], function () {
    //     // 在图面添加工具条控件，工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
    //     myGDMap.addControl(new AMap.ToolBar({
    //         // 简易缩放模式，默认为 false
    //         liteStyle: false
    //     }));
    // });
    $(document).mousemove(function(e){//获取鼠标位置，转成经纬度（区域放大下钻）
        e = e || window.event;
        // 容器坐标，原点为左上角
        var px = e.pageX;
        var py = e.pageY;
        // 构造成 Pixel 对象后传入
        mouseLnglat = myGDMap.containerToLngLat(new AMap.Pixel(px, py)); 
    })
   
   
    $('.map_tit .loc').live('click',function(){// 下钻记录点击
        mapAreaCode = $(this).attr('data-i');
        var mapLevel = getAreaLevel(mapAreaCode);
        $(this).nextAll().remove();
        $(this).addClass('active');
        if(mapLevel == 0){
            myGDMap.setZoomAndCenter(8, [120.153576,29.289523]);
            setModelMain()
        }else if(mapLevel == 1){
            myGDMap.setZoomAndCenter(9, [mapActiveAreaData.x,mapActiveAreaData.y]);
            setModelMain();
        }else if(mapLevel == 2){
            setModelMain()
        }
    })
    $('.backToOriginal').click(function () {//地图 回归定位点
        mapAreaCode = '330000';
        myGDMap.setZoomAndCenter(8, [120.153576,29.289523]);
        $('.map_tit .loc').eq(0).nextAll().remove();
        setModelMain();
    })
  
    //地图 放大
    $('.add').click(function () {
        var zoom = myGDMap.getZoom();
        if (zoom < 20) {
            myGDMap.zoomIn();
        }
    })
    //地图 缩小
    $('.del').click(function () {
        var zoom = myGDMap.getZoom();
        if (zoom > 7) {
            myGDMap.zoomOut();
        }
        
    })
    layui.use(['form','laydate'], function(){
        var laydate = layui.laydate;
        //年选择器
        laydate.render({ 
            elem: '#year',
            type: 'year',
            value: (new Date()).getFullYear(),
            min: -366,
            max: 0,
            done: function (value,date) {
                commonYear = value;
                setModelMain(true)
            },
            // change: function(value, date){ //监听日期被切换
            //     commonYear = value;
            //     setModelMain()
            // }
        });
        
    });
    $(".fhBtn").on('click',function(){
        var btnName={
            dwxybg:'单位信用报告查询类型分布',
            dwxybgqk:'信用指标'
        }
        var title=$(this).attr('data-title').split(',')
        fh_btn=!fh_btn
        if(fh_btn){
           $(this).parents('.fh_text').find(".model_title").html(btnName[title[0]])
           if(title[0]=='dwxybg'){
            getdwxybgcxlxfb()
           } 
        }else{
            $(this).parents('.fh_text').find(".model_title").html(btnName[title[1]])
            if(title[1]=='dwxybgqk'){
                getdwxybgcxlxfb1()
               } 
            
        }
    })
    $('.block_name').live('click',function () {
        var childModelClick = $(this).attr('data-model');
        if(childModelClick){
            $('.tablist .tab_item.active').attr('child-model-click',childModelClick);
            changeModelPage(true,$(this).text())
        }else{
            $('.tablist .tab_item.active').attr('child-model-click','');
        }
    })
    function changeModelPage(isChangeModel,newPageName){//TODO: 整体切换
        $('.header_r').show();
        var modelClass = $('.tablist .tab_item.active').attr('data-model');
        if(isChangeModel){
            $('.map_con').hide();
            $('.iframe_con').removeClass('iframeAnimate');
            $('.new_page').removeClass('newPageAnimate');
            $('.new_page').children().addClass('hide');
            $('.page_name').html('');
            // stopVideo(true);
            if(oWebControl){
                oWebControl.JS_HideWnd(); // 先让窗口隐藏，规避可能的插件窗口滞后于浏览器消失问题 
                oWebControl.JS_Disconnect().then(function () { // 断开与插件服务连接成功
                },
                function () { // 断开与插件服务连接失败
                });
            }
            
        }
        var pageURL = $('.tablist .tab_item.active').attr('page-url');
        var newPage = $('.tablist .tab_item.active').attr('page-new')-0;
        var childModelClick = $('.tablist .tab_item.active').attr('child-model-click');
        if(childModelClick){
            modelClass = childModelClick;
        }
        if(pageURL){
            $('.left').hide();
            $('.right').hide();
            $('.iframe_con #framePage').attr('src',pageURL);
            $('.iframe_con').addClass('iframeAnimate');
        }else if(newPage || childModelClick){
            $('.left').hide();
            $('.right').hide();
            if(modelClass == 'modelYJZH'){
                $('.header_r').hide();
            }
            $('.' + modelClass).addClass('newPageAnimate');
            if(isChangeModel){
                $('.page_name').html('·'+newPageName)
            }
            changePage(isChangeModel,childModelClick);  
        }else{
            if(modelClass == 'model1'||modelClass == 'modelLHYG'){
                $('.page_name').html('·'+newPageName)
            }
            if(isChangeModel){
                $('.left').removeClass('animate');
                $('.right').removeClass('animate');
                $('.left').children().addClass('hide');
                $('.right').children().addClass('hide');
            }
            
            changeModel(false,isChangeModel);
            setMapTypeSelects();
        }
    }
   
    function getChildren(areacode,data){
        var child = [];
        $.each(data,function(i,item){
            if(item.pid == areacode){
                child.push({
                    id: item.id,
                    pid: item.pid||'',
                    title: item.text,
                    child: getChildren(item.id,data)
                });
            }
        })
        return child;
    }
    function changeModel(notRenderMap,isChangeModel) {//TODO:tab切换
        $('.map_con').show();
        isMapClick = true;
        clearInterval(sjgjPageTimer);
        var modelClass = $('.tablist .tab_item.active').attr('data-model');
        if(isChangeModel){
            mapAreaCode = '330000';
            $('.map_tit .loc').eq(0).nextAll().remove();
            $('.left').hide();
            $('.right').hide();
            $('.' + modelClass).show();
            $('.left').addClass('animate');
            $('.right').addClass('animate');
        }
        setTimeout(function(){
            $('.left').children().removeClass('hide');
            $('.right').children().removeClass('hide');
            if (modelClass == 'model0') {
                setModelMain(notRenderMap);
            }else if(modelClass == 'model1'){
                setModelJAX(notRenderMap);
            }else if(modelClass == 'modelLHYG'){
                modelLHYG(notRenderMap);
            }
        },1500)
        
    }
    function changePage(isChangeModel,childModelClick) {//TODO: 新页面
        var modelClass = childModelClick||$('.tablist .tab_item.active').attr('data-model');
        if(isChangeModel){
            $('.' + modelClass).show();
            $('.' + modelClass).addClass('newPageAnimate');
            mapAreaCode = '330000';
            setNewPageAreaSelect('.' + modelClass,areaDatas,modelClass);
        }
        setTimeout(function(){
            $('.' + modelClass).children().removeClass('hide');
            if(modelClass == 'modelZHYP'){
                modelZHYP();
            }else if(modelClass == 'modelLHYJ'){
                modelLHYJ();
            }else if(modelClass == 'modelGZJG'){
                modelGZJG();
            }else if(modelClass == 'modelJFHJ'){
                modelJFHJ();
            }else if(modelClass == 'modelXYJG'){
                modelXYJG();
            }else if(modelClass == 'modelYJZH'){
                modelYJZH();
            }
        },1500)
        
    }
    //总体概况
    setModelMain()
    function setModelMain(notRenderMap){//TODO: 首页
       
        setMapTypeSelects()
        if(!notRenderMap){
            initMap();//初始化地图调用
        }
        getldbzjgZb()//执法监管首页右上角劳动保障监察指标
        getjgajfssmonth()//监察案件发生趋势按月
        getajgk()//案件管控 案源占比 饼图
        getajclqk()    //案件处置情况 立案前 
        getxxjj() ///zjax/admin/Djg/zfjgxxxjnum行刑衔接行(公安)0件
        getzzzx() //强制执行
        gethlwjg() //互联网+监管 顶部数字
        getssjjcs()//双随机检查量趋势http://223.4.78.47/zjax/admin/zjax/ssjTaskTrend?type=time&aab301=
        getszshjg()//事中事后监管http://223.4.78.47/zjax/admin/xyxt/queryXzxkMonth
       getxzxk() //行政许可http://223.4.78.47/zjax/admin/xyxt/queryXzxkNum
    }
    function getszshjg(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/xyxt/querySzshAllArea',{
            xzqh:mapAreaCode,
            year:commonYear,
            // aab301:mapAreaCode
        },function (res) {
            var data=res.data
            setBarOrLine("#szshjgLine",{
                unit:'件',
                "categories":data.map(item => item.area_name),
                "series":[
                    {"name":"办件量","type":"bar","data":data.map(item => item.num)},
                    {"name":"告知承诺","type":"bar","data":data.map(item => item.gzcn)},
                    {"name":"事中事后监管覆盖量","type":"line","data":data.map(item => item.szsh)},
                ]
            },{color:[
                {color2:'',color1:'#15C0FF'},
                {color2:'',color1:'#FF4E4E'},
                {color2:'',color1:'#FF4E4E'},
            ],xAxisRotate:45})
        })
    }
    function setBarOrLine(id, data, option,clickFun) {
       
        option = option || {};
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || [
            {color2:'',color1:'#15C0FF'},
            {color2:'',color1:'#34C39D'},
            {color2:'',color1:'#FF6169'},
            {color2:'',color1:'#FFBD1E'},
        ];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type||'line'
            series.push({
                animation: true ,
                name: item.name,
                stack: item.stack || '',
                type: item.type,
                data: item.data,
                barWidth: option.barWidth||10,
                // barMinHeight: (option.barWidth||10)/3,
                itemStyle: {
                    color: item.type=='line'?color[i].color1:new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: color[i].color1
                        },
                        {
                            offset: 1,
                            color: color[i].color2||color[i].color1
                        }
                    ])
                },
                yAxisIndex: item.yAxisIndex||0,
                symbol: 'circle',
                symbolSize: 4,
                smooth:true,
                lineStyle: {
                    width: 2,
                    color: color[i].color1,
                },
            })
        })
        var myOption = {
            grid: {
                left: 0,
                top:  $$.transVHFontSize(1.7+1.7),
                bottom: 0,
                right: 0,
                containLabel: true,
            },
            tooltip: {
                show: true,
                trigger: 'axis',
                confine:true
            },
            legend: {
                show: true,
                left:option.twoYAxis?'center':'right',
                top:0,
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff',
                },
            },
            xAxis: [
                {
    
                    type: 'category',
                    axisLabel: {
                        interval:0,
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                        rotate: option.xAxisRotate||0
                    },
                    boundaryGap: true,
                    interval:0,
                    data: data.categories,
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show: option["yAxisSplitLineShow"] || false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            yAxis: [
                {
                    type: 'value',
                    axisLabel: {
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                    },
                    name: unit[0] ? '单位：' + unit[0] : "",
                    nameGap: $$.transVHFontSize(1.2),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show:  false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
                {
                    show: option.twoYAxis||false,
                    type: 'value',
                    axisLabel: {
                        formatter: '{value} ',
                        color: '#ffffff',
                        textStyle: {
                            fontSize: fontSize,
                        },
                    },
                    name: unit[1] ? '单位：' + unit[1] : "",
                    nameGap: $$.transVHFontSize(1.2),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show:  false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            series: series,
        };
        myChart.setOption(myOption, true)
        myChart.off('click');
        myChart.on("click",function(params){
            var index = datas.map(item=>item.name).indexOf(params.name);
            if(index>-1){
                params.chartData = datas[index];
            }
            clickFun&&clickFun(params)
        })
    }
    function getssjjcs(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/zjax/ssjTaskTrend?type=time',{
            year:commonYear,
            aab301:mapAreaCode
         
        },function (res) {
            var data=res.data||[]
            setLine("#ssjsjclLine",{
                unit:'家',
                "categories":data.map(item => item.name),
                "series":[
                    {"name":"","data":data.map(item => item.value)},
                ]
            },{color:["#34C39D"]})
        })
    }
    function getxzxk(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/xyxt/queryXzxkNum',{
            xzqh:mapAreaCode,
             year:commonYear,
            // aab301:mapAreaCode
        },function (res) {
            setZBData(".xzxkz",res.data,function(){
                $(".xzxkz [data-key]").on("click",function(){
                    var type=$(this).attr("data-key")
                    if(type=="total"){
                        alertZBZBtable("行政许可")
                    }else if(type=="gzcn"){
                        alertZBGZCNtable("告知承诺")
                    }else if(type=="proportion"){

                    }
                })
            })
        })
    }
    function alertZBGZCNtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "申报号", field: "sbh"},
                {title: "申报时间", field: "sbsj"},
                {title: "单位名称名称", field: "applyname"},
                {title: "办件来源", field: "bjly_text"},
                {title: "统一社会信用代码", field: "apply_cardnumber"},
                {title: "申报来源", field: "bjly_text"},
            {title: "事项名称", field: "qlsxmc"},
            {title: "是否是告知承诺", field: "is_promise_text"},
            {title: "受理时间", field: "slsj"},
            {title: "办结时间", field: "bjsj"},
            ]],
            url: ajaxUrl + '/zjax/admin/xyxt/queryGzcnList',
            where: {
                year:commonYear,
                xzqh:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                
            }
        });
    }
    function alertZBZBtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "申报号", field: "sbh"},
                {title: "申报时间", field: "sbsj"},
                {title: "单位名称名称", field: "applyname"},
                {title: "办件来源", field: "bjly_text"},
                {title: "统一社会信用代码", field: "apply_cardnumber"},
                {title: "申报来源", field: "bjly_text"},
            {title: "事项名称", field: "qlsxmc"},
            {title: "是否是告知承诺", field: "is_promise_text"},
            {title: "受理时间", field: "slsj"},
            {title: "办结时间", field: "bjsj"},
            ]],
            url: ajaxUrl + '/zjax/admin/xyxt/queryXzxkList',
            where: {
                year:commonYear,
                xzqh:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                
            }
        });
    
}

    function gethlwjg(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/hlwjgTopNum',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            setZBData(".hlwjgZb",res.data,function(){
                $("[data-key]").on("click",function(){
                    var type=$(this).attr("data-key")
                      if(type=="xzjcsxnum"){
                        alertZBJCSXtable("行政检查事项")
                      }else if(type=="jgdx"){
                        alertZBJGDXtable("监管对象")
                      }else if(type=="ssjnum"){
                        alertZBSSJStable("双随机检查")
                      }else if(type=="zfjcry"){
                        alertZBZFRYStable("执法检查人员")
                      }else if(type=="wtjcnum"){
                        alertZBWTJCCStable("问题检出")
                      }else if(type=="fxxshs"){
                        alertZBFStable("风险线索核实")
                      }
                })
            })
        })
    }
    function alertZBFStable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "事件分类", field: "event_classify_content"},
                    {title: "风险主体名称", field: "event_entity_name"},
                    {title: "事件标题", field: "event_title"},
                    {title: "事件描述", field: "event_desc"},
                    {title: "发现时间", field: "discover_time"},
                    {title: "处置机构", field: "disposal_org_name"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/hlwjgfxxshsList',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBFSDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBFSDetails(obj){
            var tableColumns = [
                [
                    {title: "事件分类", field: "event_classify_content"},
                    {title: "风险主体名称", field: "event_entity_name"},
                    {title: "事件标题", field: "event_title"},
                    {title: "事件描述", field: "event_desc"},
                    {title: "发现时间", field: "discover_time"},
                    {title: "处置机构", field: "disposal_org_name"}
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/hlwjgfxxshsDetail',{
                id: obj.data.id,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function alertZBWTJCCStable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "企业统一信用代码", field: "unicode"},
                    {title: "任务", field: "taskcode"},
                    {title: "创建时间", field: "createtime"},
                    {title: "检查完成时间", field: "checkcompletetime"},
                    {title: "部门名称", field: "deptname"},
                    {title: "检查人员姓名", field: "supervisorname"},
                    {title: "录入人员", field: "setusername"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/hlwjgWtjcsList',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBWTJCCSDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBWTJCCSDetails(obj){
            var tableColumns = [
                [
                    {title: "企业统一信用代码", field: "unicode"},
                        {title: "任务", field: "taskcode"},
                        {title: "创建时间", field: "createtime"},
                        {title: "检查完成时间", field: "checkcompletetime"},
                        {title: "部门名称", field: "deptname"},
                        {title: "检查人员姓名", field: "supervisorname"},
                        {title: "录入人员", field: "setusername"}
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgMapZSsjDetail',{
                id: obj.data.taskid,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function alertZBZFRYStable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "姓名", field: "name"},
                    {title: "手机", field: "tel"},
                    {title: "机构", field: "orgname"},
                    {title: "部门", field: "deptname"},
                    {title: "是否注册", field: "sfzc"},
                    {title: "证件号码", field: "zjhm"},
                    {title: "性别", field: "sex"},
                    {title: "年龄", field: "age"},
                    {title: "学历信息", field: "xlxx"},
                    {title: "专业信息", field: "zyxx"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/hlwjgzfjcryList',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBZFRYSDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBZFRYSDetails(obj){
            var tableColumns = [
                [
                    {title: "姓名", field: "name"},
                    {title: "手机", field: "tel"},
                    {title: "机构", field: "orgname"},
                    {title: "部门", field: "deptname"},
                    {title: "是否注册", field: "sfzc"},
                    {title: "证件号码", field: "zjhm"},
                    {title: "性别", field: "sex"},
                    {title: "年龄", field: "age"},
                    {title: "学历信息", field: "xlxx"},
                    {title: "专业信息", field: "zyxx"}
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/hlwjgzfjcryDetail',{
                id: obj.data.id,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function alertZBSSJStable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "企业统一信用代码", field: "unicode"},
                    {title: "任务", field: "taskcode"},
                    {title: "创建时间", field: "createtime"},
                    {title: "检查完成时间", field: "checkcompletetime"},
                    {title: "部门名称", field: "deptname"},
                    {title: "检查人员姓名", field: "supervisorname"},
                    {title: "录入人员", field: "setusername"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjgMapZSsjList',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBSSJSDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBSSJSDetails(obj){
            var tableColumns = [
                [
                    {title: "企业统一信用代码", field: "unicode"},
                    {title: "任务", field: "taskcode"},
                    {title: "企业名称", field: "legalentityname"},
                    {title: "创建时间", field: "createtime"},
                    {title: "检查完成时间", field: "checkcompletetime"},
                    {title: "部门名称", field: "deptname"},
                    {title: "检查人员姓名", field: "supervisorname"},
                    {title: "录入人员", field: "setusername"}
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgMapZSsjDetail',{
                id: obj.data.taskid,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function alertZBJGDXtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "主体统一社会信用代码", field: "unicode"},
                {title: "主体名称", field: "entity_name"},
                {title: "详细地址", field: "detailed_address"},
                {title: "经度", field: "longitude"},
                {title: "纬度", field: "latitude"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/hlwjgJgdxList',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBJGDXDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBJGDXDetails(obj){
            var tableColumns = [
                [
                    {title: "主体名称", field: "entity_name"},
                    {title: "经度", field: "longitude"},
                    {title: "纬度", field: "latitude"},
                    {title: "主体统一社会信用代码", field: "unicode"},
                    {title: "详细地址", field: "detailed_address",fitWidth:true},
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/hlwjgJgdxDetail',{
                id: obj.data.id ,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function alertZBJCSXtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "事项名称", field: "item_name"},
                {title: "省级法律依据", field: "province_law"},
                {title: "监管对象描述", field: "supervise_object_desp"},
                {title: "检查方式", field: "check_way"},
                {title: "监管流程", field: "supervise_flow"},
                {title: "监管结果", field: "supervise_result"},
                {title: "国家法律依据", field: "national_law"},
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"xzcfsx",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBJCSXDetails(obj);//taskId 主键
            }
        });
    
        }
        function alertZBJCSXDetails(obj){
            var tableColumns = [
                [
                    {title: "事项名称", field: "item_name",fitWidth:true},
                    {title: "省级法律依据", field: "province_law",fitWidth:true},
                    {title: "监管对象描述", field: "supervise_object_desp",fitWidth:true},
                    {title: "检查方式", field: "check_way",fitWidth:true},
                    {title: "监管流程", field: "supervise_flow",fitWidth:true},
                    {title: "监管结果", field: "supervise_result",fitWidth:true},
                    {title: "国家法律依据", field: "national_law",fitWidth:true},
                ]
            ];
            var ecm = $$.alert('axzs');
            $('#' + ecm).html(`
                <div class="title">详情</div>
                <div class="table_con">
                    <div class="model">
                        <div class="model_title">基本信息</div>
                        <div class="model_content ztxxTable"></div>
                    </div>
                   
                </div>
            `);
            
            $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgxzcfsxdetail',{
                id: obj.data.item_code,
                year:commonYear,
                aab301:mapAreaCode
            },function(res){
                var data = res.data ||　{};
                $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
              
            });
        }
    function getzzzx(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgqzzxnum',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            setZBData(".qzzxZb",res.data,function(){
                $(".qzzxZb").on("click",function(){
                    alertZBqzzxZbtable("强制执行")
                })
            })
        })
    }
    function alertZBqzzxZbtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "立案编号", field: "abb016"},
                {title: "案由", field: "aba002"},
                {title: "立案时间", field: "abb017"},
                {title: "登记时间", field: "abb277"},
                {title: "主板监察员姓名", field: "abb010t"},
                {title: "协办监察员姓名", field: "abb011t"},
                {title: "当事人姓名", field: "aab004"},
                {title: "所属管辖", field: "aab301s"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjgqzzxlist',
            where: {
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBqzzxZbDetails(obj)
            }
        });
     }
     function alertZBqzzxZbDetails(obj){
        var tableColumns = [
            [
                {title: "立案编号", field: "abb016"},
                {title: "案由", field: "aba002"},
                {title: "立案时间", field: "abb017"},
                {title: "登记时间", field: "abb277"},
                {title: "主板监察员姓名", field: "abb010t"},
                {title: "协办监察员姓名", field: "abb011t"},
                {title: "当事人姓名", field: "aab004"},
                {title: "所属管辖", field: "aab301s"},
                {title: "案件来源", field: "abb006"},
                {title: "申请日期", field: "abb087"},
                {title: "受理法院", field: "abb103"},
                {title: "申请类型", field: "abz100"},
                {title: "文书送达日期'", field: "abb086"},
                {title: "申请人地址", field: "abb085"},
                {title: "申请人职务", field: "abb088"},
                {title: "申请人联系电话", field: "abb089"}
            ]
        ];
        var ecm = $$.alert('axzs');
        $('#' + ecm).html(`
            <div class="title">详情</div>
            <div class="table_con">
                <div class="model">
                    <div class="model_title">基本信息</div>
                    <div class="model_content ztxxTable"></div>
                </div>
               
            </div>
        `);
        
        $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgqzzxdetail',{
            id: obj.data.abz001,
            year:commonYear,
            aab301:mapAreaCode
        },function(res){
            var data = res.data ||　{};
            $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
          
        });
     }
    function getxxjj(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgxxxjnum',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            setZBData(".xxjjZb",res.data,function(){
                $(".xxjjZb").on("click",function(){
                    alertZBxxjjZbtable("行刑衔接")
                })
            })
        })
    }
    function alertZBxxjjZbtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "立案编号", field: "abb016"},
                {title: "案由", field: "aba002"},
                {title: "立案时间", field: "abb017"},
                {title: "登记时间", field: "abb277"},
                {title: "主板监察员姓名", field: "abb010t"},
                {title: "协办监察员姓名", field: "abb011t"},
                {title: "当事人姓名", field: "aab004"},
                {title: "所属管辖", field: "aab301s"},
                {title: "案件来源", field: "abb006"},
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjgxxxjlist',
            where: {
                year:commonYear,
                aab301:mapAreaCode 
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBxxjjZbDetails(obj)
                //alertZBAYABDetails(abb006);
            }
        });
     }
     function alertZBxxjjZbDetails(obj){
        var tableColumns = [
            [
                {title: "立案编号", field: "abb016"},
                {title: "案由", field: "aba002"},
                {title: "立案时间", field: "abb017"},
                {title: "登记时间", field: "abb277"},
                {title: "主板监察员姓名", field: "abb010t"},
                {title: "协办监察员姓名", field: "abb011t"},
                {title: "当事人姓名", field: "aab004"},
                {title: "所属管辖", field: "aab301s"},
                {title: "案件来源", field: "abb006"},
                {title: "移送依据", field: "abb268"},
                {title: "移送材料清单", field: "abb269"},
                {title: "受移送单位", field: "abb266"},
                {title: "经办人", field: "aae011"},
                {title: "移送时间'", field: "aae036"},
               
            ]
        ];
        var ecm = $$.alert('axzs');
        $('#' + ecm).html(`
            <div class="title">详情</div>
            <div class="table_con">
                <div class="model">
                    <div class="model_title">基本信息</div>
                    <div class="model_content ztxxTable"></div>
                </div>
               
            </div>
        `);
        
        $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgxxxjdetail',{
            id: obj.data.abz001,
            year:commonYear,
            aab301:mapAreaCode
        },function(res){
            var data = res.data ||　{};
            $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
          
        });
     }
    function getajclqk() {
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgajczqklaq',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data
            setData("#laclqk",data,function(){
                $("#laclqk [data-key]").on("click",function(){
                    var type=$(this).attr("data-key")
                    var code=$(this).attr("code")
                   
                    alertZBQLtable("案件信息",code)
                    // if(type=="laq_box1"){
                       
                    // }else if(type=="laq_box2"){
                    //     alertZBQLtable("案件处置",code)
                    // }
                }) 
            })
            $(".laq_box").show()
            $(".lah_box").hide()
        }) 
    }
    function alertZBQLtable(title,bba005){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"jcaj",
                bba005: bba005||"",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBQLDetails(obj);//taskId 主键
            }
        });
    
   }
function alertZBQLDetails(obj){
    var tableColumns = [
        [
            {title: "案件编号", field: "abb016"},
            {title: "基本诉求", field: "aba003"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "案由", field: "aba002"},
            {title: "投诉人", field: "tsr"},
            {title: "被投诉人", field: "btsr"},
            {title: "案件名称", field: "ajname"},
            {title: "所属辖区", field: "aab301s"},
            {title: "当前状态", field: "bb1004"},
            {title: "基本案情", field: "abb012",fitWidth:true},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);

    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgjcajdetail',{
        id: obj.data.abz001,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
    
    });
}
    function getajclqk1() {
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgajczqklah',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data
            setData1("#laclqk1",data,function(){
                $("#laclqk1 [data-key]").on("click",function(){
                    var type=$(this).attr("data-key")
                    var code=$(this).attr("code")
                    alertZBQL1table("案件信息",code)
                }) 
            })
            $(".laq_box").hide()
            $(".lah_box").show()
        }) 
    }
    function alertZBQL1table(title,abb4b4){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"jcaj",
                abb4b4: abb4b4||"",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBQL1Details(obj);//taskId 主键
            }
        });
    
}
function alertZBQL1Details(obj){
    var tableColumns = [
        [
            {title: "案件编号", field: "abb016"},
            {title: "基本诉求", field: "aba003"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "案由", field: "aba002"},
            {title: "投诉人", field: "tsr"},
            {title: "被投诉人", field: "btsr"},
            {title: "案件名称", field: "ajname"},
            {title: "所属辖区", field: "aab301s"},
            {title: "当前状态", field: "bb1004"},
            {title: "基本案情", field: "abb012",fitWidth:true},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);

    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgjcajdetail',{
        id: obj.data.abz001,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
    
    });
}
    function setData1(id,data,clickFun){
        var html_=""
        var datas=[]
        $.each(data,function(i,item){
            var length=item.name.length
            datas.push(item.num)
            html_+=`<div style="width: ${length>2?'35':'30'}%;" class="${i<3?'mar_b':''}">
          <p class="laBox">
          <span class="zb_title">${item.name}</span>
          <span><i class="num" data-key="lah_box${i+1}" code="${item.code}">${item.num}</i>
          <i class="unit">件</i></span>
         </p>
      </div>`
        })
      $(id).html(html_)
      clickFun&&clickFun()
    }
    function setData(id,data,clickFun){
        var html_=""
        var datas=[]
        $.each(data,function(i,item){
            datas.push(item.num)
            html_+=`<div>
          <p class="laBox">
          <span class="zb_title">${item.name}:</span>
          <span><i class="num" data-key="laq_box${i+1}" code="${item.code}">${item.num}</i>
          <i class="unit">件</i></span>
         </p>
      </div>`
        })
       
      $(id).html(html_)
      setblBar("#blBar",{left:datas[0],right:datas[1]})
      clickFun&&clickFun()
    }
    function getajgk(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgayzb',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data.map(item =>{
                return{
                    name:item.name,
                    value:item.num
                }
            })
            setPie('#ajgkPei',{datas:data,unit:"件"},{
                showValue:true,
                showPercent:false,
                nameWidth:$$.fitFontSize(120),
                // legendTop:"70%",
                // legendItemGap:$$.transVHFontSize(.8),
                // center:['50%', '35%'],
                legendLeft:"50%",
                radius: ['55%', '82%'],
                radius2:["55%","58%"]
            },function(params){
                var index = res.data.map(item=>item.name).indexOf(params.name)
                alertZBAYZBtable(params.name,res.data[index].code)
            });
        })
    }
    function alertZBAYZBtable(title,abb006){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"jcaj",
                abb006:abb006||"",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                //alertZBAYABDetails(abb006);
            }
        });
     }

    function getajgk1(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjganyouzb',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data.map(item =>{
                return{
                    name:item.name,
                    value:item.num
                }
            })
            setPie('#ajgkPei',{datas:data,unit:"件"},{
                showValue:true,
                showPercent:false,
                legendTop:"12%",
                nameWidth:$$.fitFontSize(120),
                legendLeft:"50%",
                radius: ['55%', '82%'],
                radius2:["55%","58%"],
                type:"scroll"
            },function(params){
                var index = res.data.map(item=>item.name).indexOf(params.name)
                alertZAYtable(params.name,res.data[index].code)
            });
        })
    }
    function alertZAYtable(title,abz150){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"jcaj",
                abz150:abz150||"",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                //alertZBAYABDetails(abb006);
            }
        });
}

    function getjgajfssmonth(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgjcajfsqs?type=month',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data
            setLine("#ajfsqsLine",{
                unit:'件',
                "categories":data.map( item => item.name),
                "series":[
                    {"name":"","data":data.map( item => item.num)},
                ]
            },{color:["#34C39D"]})
        })
    }
    function getjgajfssyear(){
        $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjgjcajfsqs?type=year',{
            year:commonYear,
            aab301:mapAreaCode
        },function (res) {
            var data=res.data
            setLine("#ajfsqsLine",{
                unit:'件',
                "categories":data.map(item => item.name),
                "series":[
                    {"name":"","data":data.map(item => item.num)},
                ]
            },{color:["#34C39D"]})
        })
    }
   function getldbzjgZb(){
    $$.ajaxRequest(ajaxUrl +'/zjax/admin/Djg/zfjglefttop  ',{
        year:commonYear,
        aab301:mapAreaCode
    },function (res) {
        setZBData(".ldbzjgZb",res.data,function(){
             $("[data-key]").on("click",function(){
                 var type=$(this).attr("data-key")
                  if(type=="smsc"){
                    alertZBSMCJtable("书面审查")
                  }else if(type=="sxnum"){
                    alertZBXZSXtable("行政处罚事项")
                  }else if(type=="zfrynum"){
                    alertZBZFRYtable("执法人员")
                  }else if(type=="ajs"){
                    alertZBAJStable("监察案件")
                  }else if(type=="bjs"){
                    alertZBBJStable("监察办结")
                  }
             })
        })
    })
   }
   function alertZBBJStable(title){
    $$.alertTable({
        title: title+'  ',
        colsData: [[
            { type: 'numbers', title: '序号' },
            {title: "案件名称", field: "ajname"},
            {title: "案件编号", field: "abb016"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "所属辖区", field: "aab301s"},
            {title: "当前状态", field: "bb1004"}
        ]],
        url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
        where: {
            type:"jcaj",
            bj:1,
            year:commonYear,
            aab301:mapAreaCode
        },
        pageProp: {
            limit: 10
        },
        rowClickFun: function (obj) {
            alertZBBJSDetails(obj)
        }
    });
   }
   function alertZBBJSDetails(obj){
    var tableColumns = [
        [
            {title: "案件编号", field: "abb016"},
            {title: "基本诉求", field: "aba003"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "所属辖区", field: "aab301s"},
            {title: "当前状态", field: "bb1004"},
            {title: "投诉人", field: "tsr"},
            {title: "被投诉人", field: "btsr"},
            {title: "案件名称", field: "ajname"},
            {title: "基本案情", field: "abb012",fitWidth:true},
            {title: "案由", field: "aba002",fitWidth:true},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);
    
    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgjcajdetail',{
        id: obj.data.abz001,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
      
    });
   }
   function alertZBAJStable(title){
    $$.alertTable({
        title: title+'  ',
        colsData: [[
            { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
        ]],
        url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
        where: {
            type:"jcaj",
            year:commonYear,
            aab301:mapAreaCode
        },
        pageProp: {
            limit: 10
        },
        rowClickFun: function (obj) {
            alertZBAJSDetails(obj)
        }
    });
   }
   function alertZBAJSDetails(obj){
    var tableColumns = [
        [
            {title: "案件编号", field: "abb016"},
            {title: "基本诉求", field: "aba003"},
            {title: "基本案情", field: "abb012"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "所属辖区", field: "aab301s"},
            {title: "投诉人", field: "tsr"},
            {title: "被投诉人", field: "btsr"},
            {title: "案件名称", field: "ajname"},
            {title: "当前状态", field: "bb1004"},
            {title: "案由", field: "aba002",fitWidth:true},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);
    
    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgjcajdetail',{
        id: obj.data.abz001,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
      
    });
   }
   function alertZBZFRYtable(title){
    $$.alertTable({
        title: title+'  ',
        colsData: [[
            { type: 'numbers', title: '序号' },
            {title: "姓名", field: "username"},
            {title: "执法证号", field: "abf041"},
            {title: "证件有效期", field: "abf044"},
            {title: "工作单位", field: "aab004"},
            {title: "证件号码", field: "aac147"},
            {title: "所属辖区", field: "aab301s"},
        ]],
        url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
        where: {
            type:"zfry",
            year:commonYear,
            aab301:mapAreaCode
        },
        pageProp: {
            limit: 10
        },
        rowClickFun: function (obj) {
            alertZBZFRYDetails(obj);//taskId 主键
        }
    });
   }
   function alertZBZFRYDetails(obj){
    var tableColumns = [
        [
            {title: "姓名", field: "username"},
            {title: "执法证号", field: "abf041"},
            {title: "证件有效期", field: "abf044"},
            {title: "工作单位", field: "aab004"},
            {title: "证件号码", field: "aac147"},
            {title: "所属辖区", field: "aab301s"},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);
    
    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgzfrydetail',{
        id: obj.data.ryid,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
      
    });
   }
   function alertZBXZSXtable(title){
    $$.alertTable({
        title: title+'  ',
        colsData: [[
            { type: 'numbers', title: '序号' },
            {title: "事项名称", field: "item_name"},
            {title: "省级法律依据", field: "province_law"},
            {title: "监管对象描述", field: "supervise_object_desp"},
            {title: "监管流程", field: "supervise_flow"},
            {title: "监管结果", field: "supervise_result"},
            {title: "国家法律依据", field: "national_law"},
        ]],
        url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
        where: {
            type:"xzcfsx",
            year:commonYear,
            aab301:mapAreaCode
        },
        pageProp: {
            limit: 10
        },
        rowClickFun: function (obj) {
            alertZBXZSXDetails(obj);//taskId 主键
        }
    });

    }
function alertZBXZSXDetails(obj){
var tableColumns = [
    [
        {title: "事项名称", field: "item_name",fitWidth:true},
        {title: "省级法律依据", field: "province_law",fitWidth:true},
        {title: "监管对象描述", field: "supervise_object_desp",fitWidth:true},
        {title: "监管流程", field: "supervise_flow",fitWidth:true},
        {title: "监管结果", field: "supervise_result",fitWidth:true},
        {title: "国家法律依据", field: "national_law",fitWidth:true},
    ]
];
var ecm = $$.alert('axzs');
$('#' + ecm).html(`
    <div class="title">详情</div>
    <div class="table_con">
        <div class="model">
            <div class="model_title">基本信息</div>
            <div class="model_content ztxxTable"></div>
        </div>
       
    </div>
`);

$$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgxzcfsxdetail',{
    id: obj.data.item_code,
    year:commonYear,
    aab301:mapAreaCode
},function(res){
    var data = res.data ||　{};
    $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
  
});
}
   function alertZBSMCJtable(title){
        $$.alertTable({
            title: title+'  ',
            colsData: [[
                { type: 'numbers', title: '序号' },
                {title: "被检查单位名称", field: "aab004"},
                {title: "书面审查状态", field: "abb369s"},
                {title: "检查材料", field: "abb367"},
                {title: "审查日期", field: "abb057"},
                {title: "主办监察员姓名", field: "abb276"},
                {title: "审查类型", field: "abb363s"},
                {title: "所属管辖", field: "aab301s"},
            ]],
            url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
            where: {
                type:"smsc",
                year:commonYear,
                aab301:mapAreaCode
            },
            pageProp: {
                limit: 10
            },
            rowClickFun: function (obj) {
                alertZBSMCJDetails(obj);//taskId 主键
            }
        });
    
}
function alertZBSMCJDetails(obj){
    var tableColumns = [
        [
            {title: "被检查单位名称", field: "aab004"},
            {title: "书面审查状态", field: "abb369s"},
            {title: "检查材料", field: "abb367"},
            {title: "审查日期", field: "abb057"},
            {title: "主办监察员姓名", field: "abb276"},
            {title: "审查类型", field: "abb363s"},
            {title: "所属管辖", field: "aab301s"}
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);
//     <div class="model czqk">
//     <div class="model_title">处置情况</div>
//     <div class="model_content jbqkTable"></div>
// </div>
    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgsmscdetail',{
        id: obj.data.abz075,
        year:commonYear,
        aab301:mapAreaCode
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
        // if(data.yja011-0 == 2){
        //     $$.title2Table('#'+ecm+' .jbqkTable', tableColumns[2], data||{},2);
        // }else{
        //     $('#'+ecm+' .czqk').hide();
        // }
    });
}
    function setblBar(id,data){
        var myCharts = echarts.init($(id)[0]);
        var rightData=[]
        var leftData=[]
        rightData.push((data.right-0)+(data.left-0))
        leftData.push(data.left-0)
        var option=option = {
            xAxis: {
                   type: 'value',
                   data: ['received', 'accountsReceivable'],
                   show: false,
                 },
                 yAxis: {
                   type: 'category',
                   show: false,
                 },
                 grid: {
                   bottom: 0,
                   right: 0,
                   left: 0,
                   top:0
                 },
                 series: [
                   {
                     name: '已收',
                     type: 'bar',
                     stack: '总量',
                     data: leftData,
                     barWidth: 12,
                     itemStyle: {
                       color: '#2F9EFE',
                       barBorderRadius: [10, 0, 0, 10]
                     },
                     label: {
                       show: false,
                       formatter: '{name| {a} }{value| {c} }',
                       align: 'left',
                       position: [-4, -20],
                       rich: {
                         value: {
                           color: '#2F9EFE',
                           fontSize: 18,
                        //    fontWeight: 500,
                           lineHeight: 10,
                         },
                         name: {
                           color: '#fff',
                           fontSize: 16,
                        //    fontWeight: 400,
                           lineHeight: 10,
                         },
                       },
                     },
                   },
                   {
                     name: '应收',
                     type: 'bar',
                     stack: '总量',
                     data:rightData,
                     barWidth: 12,
                     itemStyle: {
                       color: '#FDAE5A',
                       barBorderRadius: [0, 10, 10, 0]
                     },
                     label: {
                        show:false,
                       formatter: '{name| {a} }{value| {c} }',
                       align: 'right',
                       position: [4, -20],
                       rich: {
                         value: {
                           color: '#FDAE5A',
                           fontSize: 18,
                           fontWeight: 500,
                           lineHeight: 30,
                         },
                         name: {
                           color: '#95A4B3',
                           fontSize: 14,
                           fontWeight: 400,
                           lineHeight: 30,
                         },
                       },
                     },
                   },
                 
                 ],
         };
        myCharts.setOption(option)
    }
  function PercentCircle(id,data,options,clickFun){
    var elem = $(id)[0];
    var radius =options.radius||['60%', '70%']
    var fontSize=options.fontSize||20
    var title=data.value+data.unit;
    var colors=options.colors||{color1:'#FFBE4E',color2:'#FF9A37'}
    var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
    var myOption = {
        title: {
            text: title,
            x: 'center',
            y: 'center',
            textStyle: {
                fontWeight: 'normal',
                color: '#fff',
                fontSize:fontSize
            }
        },
        color: ['#282c40'],
        legend: {
            show: true,
            data: []
        },
        series: [{
            name: 'percent',
            type: 'pie',
            clockWise: true,
            radius: radius,
            center:['50%','50%'],
            itemStyle: {
                normal: {
                    label: {
                        show: false
                    },
                    labelLine: {
                        show: false
                    }
                }
            },
            hoverAnimation: false,
            data:[
                {
                    value:data.value-0,
                    name: 'finished',
                    itemStyle: {
                        color: { // 完成的圆环的颜色
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0, color:colors.color1||'#456FFB' // 0% 处的颜色
                            },{
                                offset: .5, color:colors.color2||'#456FFB' // 0% 处的颜色
                            }, {
                                offset: 1, color:colors.color2||'#456FFB' // 100% 处的颜色
                            }],
                            global: false
                        }           
                    }
                }, 
                {
                    name: 'unfinished',
                    value:100-data.value,
                    itemStyle:{
                        color:'rgba(42,69,136,1)'
                    }
                }
            ]
        }]
    };
    myChart.setOption(myOption, true)
    myChart.off("click");
    myChart.on("click",function(params){
        clickFun&& clickFun(params)
    });
    function formatData(){
        var data = [
            {
                value: 0,
                name: 'finished',
                itemStyle: {
                    color: { // 完成的圆环的颜色
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#2380FF' // 0% 处的颜色
                        },{
                            offset: .5, color: '#2380FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2380FF' // 100% 处的颜色
                        }],
                        global: false
                    }           
                }
            }, 
            {
                name: 'unfinished',
                value: 0,
                itemStyle:{
                    color:'#EBEFFA'
                }
            }
        ],title='';
        let percent = 0,total = 0,value = 0;
        if(typeof data == 'number'){
            value = Number(data);
            if(Math.abs(data)<1 && Math.abs(data)>0){
                total = 1;
                percent = data==0?0:(data*100).toFixed(2);
            }else if(Math.abs(data)<100 && Math.abs(data)>1){
                total = 100;
                percent = data==0?0:(data).toFixed(2);
            }
        }else{
            value = data.value-0;
            total = data.total-0||100;
            percent = value==0?0:(value/total * 100).toFixed(2);
        }
        title = percent + '%'+"\n完成率";
        data[0].value = value;
        data[1].value = total - value;
        
        return {
            data: data,
            title: title
        };
    }
  }
    
    function setPie(id, data, option,clickFun) {
      
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.datas;
        var maxNameLength = ((datas.map(item => {
            return item.name.length;
        })).sort(function (a, b) {
            return b - a;
        }))[0];
        var total = 0;
        datas.map(item => {
            total += item.value;
        })
       var series=[{
        type: "pie",
        radius: option.radius||['35%', '65%'],
        center: option.center||['20%', '50%'],
        roseType:option.roseType||false,
        name: data.name || '',
        label: {
            show: false
        },
        labelLine: {
            show: false
        },
        data: datas,
        hoverOffset:5,
        minAngle: 5 ,
        animation: true ,
    },]
     if(!option.normalPie){
        series.push({
            type: "pie",
            radius: option.radius2|| ['35%', '38%'],
            center: option.center||['20%', '50%'],
            name: '',
            label: {
                show: false
            },
            labelLine: {
                show: false
            },
            data: [{
                value: 1,
                itemStyle: {
                    color: '#fff'
                }
            }],
            hoverAnimation:false
        })
     }
        var myOption = {
            color: option.color || ['#2F9EFE', '#34C39D', '#FDAE5A', '#FF6169', '#8E67FF', '#89D47F'],
            grid: {
                left: 0,
                right: 0,
                top: 0,
                bottom: 0,
                containLabel: true,
            },
            tooltip:{
                show:true,
                formatter: '{b}<br />数值：{c}<br />占比：{d}%',
                confine: true,
                // padding:0
            },
            legend: {
                // type:datas.length>8?'scroll':'',
                orient: "vertical",
                type: option.type||'',
                top: option.legendTop||'middle',
                left: option.legendLeft || "60%",
                itemWidth: $$.transVHFontSize(1.5),
                itemHeight: $$.transVHFontSize(1.1),
                itemGap: option.legendItemGap || $$.transVHFontSize(.6),
                padding: 0,
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff',
                    rich: {
                        name: {
                            fontSize: fontSize,
                            width:option.nameWidth|| maxNameLength * $$.fitFontSize(18)
                        },
                        value: {
                            fontSize: fontSize,
                            color: '#fff'
                        },
                        percent: {

                        }
                    }
                },
                // formatter:datas.length>8?'{name}':
                formatter: function (name) {
                    var showValue = option.showValue || false,
                        showPercent = option.showPercent || false;
                    var index = datas.map(item => item.name).indexOf(name);
                    if (name && index > -1) {
                        var value = datas[index].value,
                            percent = (value / total * 100).toFixed(option.fixedNum || 2);
                        return [
                            '{name|' + name + '}',
                            showValue ? '{value|' + (value + (data.unit || '')) + '}' : '',
                            showPercent ? '{percent|' + (percent + '%') + '}' : '',
                        ].join('')
                    } else {
                        return name
                    }
                },
                pageIconSize: $$.transVHFontSize(1),
                pageIconColor: '#2f4554' ,
                pageIconInactiveColor: '#fff' ,
                pageTextStyle:{
                    fontSize: fontSize,
                    color: '#fff',
                }
            },
            series:series
            // series: [{
            //         type: "pie",
            //         radius: option.radius||['35%', '65%'],
            //         center: option.center||['20%', '50%'],
            //         roseType:option.roseType||false,
            //         name: data.name || '',
            //         label: {
            //             show: false
            //         },
            //         labelLine: {
            //             show: false
            //         },
            //         data: datas,
            //         hoverOffset:5,
            //         minAngle: 5 ,
            //         animation: true ,
            //     },
            //     {
            //         type: "pie",
            //         radius: ['35%', '38%'],
            //         center: option.center||['20%', '50%'],
            //         name: '',
            //         label: {
            //             show: false
            //         },
            //         labelLine: {
            //             show: false
            //         },
            //         data: [{
            //             value: 1,
            //             itemStyle: {
            //                 color: '#fff'
            //             }
            //         }],
            //         hoverAnimation:false
            //     },
            // ]
        }
        myChart.setOption(myOption, true);
        // myChart.off('click');
        // myChart.on('click',function(params){
        //     console.log(params,"puuu")
        //     // clickFun&& clickFun(params)
        // });
        myChart.off("legendselectchanged");
        myChart.on("legendselectchanged",function(params){
            
            var isSelected = params.selected[params.name];
            var title=params.name
            if(isSelected == false){
                myChart.dispatchAction({
                    type:'legendToggleSelect',
                    name: params.name
                });
                myChart.dispatchAction({
                    type:'highlight ',
                    name: params.name
                });
                clickFun&& clickFun(params)
            }
        });
    }
    function setRadar(id, data,total){
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var indicator = data.map(item=>{
            return {
                name: item.name+'('+(item.value||0)+')',
                max: 100
            }
        })
        var myOption = {
            // backgroundColor:'#000',
            title: {
                text: total||0,
                left:'center',
                top:'middle',
                textStyle:{
                        color:'#fff',
                        fontSize: $$.fitFontSize(36),
                        fontWeight:'bold'
                    }
            },
            legend:{
                show:false
            },
            radar: {
                shape: 'circle',
                radius: '50% ',
                indicator: indicator,
                name:{
                    textStyle:{
                        color:'#fff',
                        fontSize: $$.fitFontSize(18)
                    }
                },
                splitLine:{
                    lineStyle:{
                        color:'#8793a2',
                        type:'dotted'
                    }
                },
                axisLine:{
                    lineStyle:{
                        color:'#8793a2',
                        type:'dotted'
                    }
                },
                splitArea:{
                    show:false
                }
            },
            series: [{
                animation: true ,
                name: 'value',
                type: 'radar',
                data: [
                    {
                        value: data.map(item=>item.value),
                        name: '值'
                    }
                ],
                itemStyle:{
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#1673FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2FCAFD' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                },
                lineStyle:{
                    width:4,
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#1673FF' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#2FCAFD' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                },
                areaStyle:{
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#4FB2F8' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#1170C2' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                    }
                }
            }]
        };
        myChart.setOption(myOption, true)
    }
    function setLine(id, data, option) {
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || ['rgba(72,182,255,1)', '#8E67FF', '#2F9EFE'];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type||'line'
            series.push({
                animation: true ,
                name: item.name,
                stack: item.stack || '',
                type: item.type||'line',
                data: item.data,
                symbol: 'circle',
                // symbol: 'emptyCircle',
                symbolSize: 4,
                smooth: option.notSmooth?false:true,
                barWidth:10,
                lineStyle: {
                    width: 2,
                    color: color[i]
                },
                itemStyle: {
                    color: color[i]
                },
                areaStyle: {
                    show: option.hideArea?false:true,
                    color: color[i],
                    opacity: option.hideArea?0:.2
                },
                label:{
                    show:option.seriesLabel?true:false,
                    position:'top',
                    distance:1,
                    textStyle:{
                        color: color[i],
                        fontSize: fontSize-2
                    }
                }
            })
        })
        var myOption = {
            color: color,
            grid: {
                left:  '2%',
                right: '6%',
                top: series.length==1?$$.transVHFontSize(1.7+1.7):$$.transVHFontSize(6),
                bottom: '0',
                containLabel: true,
            },
            legend: {
                show: series.length==1?false:true,
                orient: "horizontal",
                top: 'top',
                left:"center",
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff'
                }
            },
            tooltip: {
                show: true,
                trigger: "axis",
                // formatter:  (params)=> {// tooltip的formatter
                //     var relVal = params[0].name
                //     for (var i = 0, l = params.length; i < l; i++) {
                //       let settingUnit = this.option.setting[i].yAxisName;
                //       let unit = settingUnit || this.option.yAxis && this.option.yAxis[params[i].seriesIndex] && this.option.yAxis[params[i].seriesIndex].name || this.option.yAxisName;
                //         relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + (unit||'')
                //     }
                //     return relVal
                // }
            },
            xAxis: [{
                type: "category",
                show: true,
                interval: 0,
                boundaryGap:chartType=='bar'?true:false,
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                    interval: option.interval||0,
                    rotate: option.xAxisRotate||0,
                    formatter: option.xAxisOverflow?function(params){
                        return params.length>3?params.substr(0,2)+'...':params;
                        return params.split('').join('\n')
                    }:'{value}'
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show:  true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
                data: data.categories,
            }, ],
            yAxis: {
                show: true,
                type: "value",
                name: unit ? '单位：' + unit : "",
                nameGap: $$.transVHFontSize(1),
                nameTextStyle: {
                    //   align: "right",
                    fontSize: fontSize,
                    color: "#fff",
                },
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show:  true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
            },
            series: series
        }
        myChart.setOption(myOption, true)
    }
    function setBar(id, data, option,clickFun) {
        var elem = $(id)[0];
        var myChart = echarts.getInstanceByDom(elem) || echarts.init(elem);
        var datas = data.series,
            series = [],
            unit = data.unit;
        var color = option.color || [
            {color2:'#ACCBFF',color1:'#2F9EFE'},
            {color2:'#ACCBFF',color1:'#2FFEAE'},
            {color2:'#ACCBFF',color1:'#FE9F2F'},
        ];
        var chartType = '';
        datas.map((item, i) => {
            chartType = item.type||'line'
            series.push({
                animation: true ,
                name: item.name,
                stack: item.stack || '',
                type: 'bar',
                data: item.data,
                barWidth:10,
                itemStyle: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: color[i].color1
                        },
                        {
                            offset: 1,
                            color: color[i].color2
                        }
                    ])
                },
                label:{
                    show:option.showLable||false,
                    position:'top',
                    distance:1,
                    textStyle:{
                        color: color[i],
                        fontSize: $$.fitFontSize(16)
                    }
                }
            })
        })
        var myOption = {
            color: color,
            grid: {
                left:  '1%',
                right: 0,
                top: unit ? $$.transVHFontSize(1.5 + 1.7) : 0,
                bottom: '0',
                containLabel: true,
            },
            legend: {
                show: series.length==1?false:true,
                orient: "horizontal",
                top: 'top',
                left: "right",
                itemWidth: $$.transVHFontSize(1.2),
                itemHeight: $$.transVHFontSize(.8),
                itemGap: $$.transVHFontSize(2),
                textStyle: {
                    fontSize: fontSize,
                    color: '#fff'
                }
            },
            tooltip: {
                show: true,
                trigger: "axis",
                // formatter:  (params)=> {// tooltip的formatter
                //     var relVal = params[0].name
                //     for (var i = 0, l = params.length; i < l; i++) {
                //       let settingUnit = this.option.setting[i].yAxisName;
                //       let unit = settingUnit || this.option.yAxis && this.option.yAxis[params[i].seriesIndex] && this.option.yAxis[params[i].seriesIndex].name || this.option.yAxisName;
                //         relVal += '<br/>' + params[i].marker + params[i].seriesName + ' : ' + params[i].value + (unit||'')
                //     }
                //     return relVal
                // }
            },
            xAxis: [{
                type: "category",
                show: true,
                interval: 0,
                boundaryGap:true,
                axisLabel: {
                    show: true,
                    fontSize: fontSize,
                    color: "#fff",
                    interval: option.interval||0,
                    rotate: option.xAxisRotate||0,
                    formatter: option.xAxisOverflow?function(params){
                        return params.length>3?params.substr(0,2)+'...':params;
                        return params.split('').join('\n')
                    }:'{value}'
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "#4F6776"
                    },
                },
                axisTick: {
                    show:  true,
                    lineStyle: {
                        color: "#4F6776",
                    },
                },
                splitLine: {
                    show: option["yAxisSplitLineShow"] || false,
                    lineStyle: {
                        type: "dotted",
                        width: 0.5,
                        color: "#4F6776",
                    },
                },
                data: data.categories,
            }, ],
            yAxis: [
                {
                    show: true,
                    type: "value",
                    name: unit ? '单位：' + unit : "",
                    nameGap: $$.transVHFontSize(1.5),
                    nameTextStyle: {
                        //   align: "right",
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLabel: {
                        show: true,
                        fontSize: fontSize,
                        color: "#fff",
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: "#4F6776"
                        },
                    },
                    axisTick: {
                        show:  true,
                        lineStyle: {
                            color: "#4F6776",
                        },
                    },
                    splitLine: {
                        show: option["yAxisSplitLineShow"] || false,
                        lineStyle: {
                            type: "dotted",
                            width: 0.5,
                            color: "#4F6776",
                        },
                    },
                },
            ],
            series: series
        }
        myChart.setOption(myOption, true)
        myChart.off('click').on("click",function(params){
            clickFun&&clickFun(params)
        })
    }
    function setZBData(id,originalData,callback){
        var data = originalData||{};
        if(originalData){
            $.each(originalData,function(k,val){
                if($(id+' [data-key="'+k+'"]') && $(id+' [data-key="'+k+'"]').length>0){
                    $(id+' [data-key="'+k+'"]').html(val||0);
                    $(id+' .num[data-key="'+k+'"]').rollNum({
                        deVal: val - 0,
                        transToThursand: true
                        // className:'my_scroll_num'
                    });
                }
            })
        }
        
        // $(id+' [data-key]').each(function(i,ele){
        //     var key = $(this).attr('data-key');
        //     $(ele).html(data[key]||0)
        // })
       
        callback && callback(data);
    }
    function setMapTypeSelects(){// 动态生成地图指标
        var type = "main";
        var selectDatas = mapTypes[type],html='';
        $.each(selectDatas,function(i,item){
            html += `<div class="tab_content_item ${item.value}" >
                        <input type="radio" name="mapType" checked group="mapType" value="${item.value}" />
                        <i class="radio"></i>
                       
                        <span class="map_type_name">${item.name}</span>
                    </div>`
        });
        $('.chose_box').html(html);
        $('.tab_content_item [name="mapType"]').change(function(){//TODO: 切换地图类型
            // return;
            var type = $('.tablist .tab_item.active').attr('data-maptype');
            
            initMap(type=='lhyg'?'330000':'');
            setMapLevel();
          
        });
        $('.tab_content_item').eq(0).find('[name="mapType"]').attr("checked",true);
        setMapLevel();
      

    }
    function setMapLevel(){
        var type = "main";
        var subType = $('.tab_content_item [name="mapType"]:checked').val();
        if(subType == 'cyrrs' || type =='ldmjzz' || type =='dxsjjq'){
            $('.levels_con').hide();
            return;
        }else{
            $('.levels_con').show();
        }
        var selectDatas = mapLevelSelects[type+'_'+subType],html='';
        if(selectDatas && selectDatas.length>0){
            $.each(selectDatas,function(i,item){
                html += `<div class="item">
                            <i class="rect ${ item.class }"></i>
                            <span>${ getLevelText(item) }</span>
                        </div>`
            });
            $('.levels_con').html(html);
        }else{
            $('.levels_con').hide();
        }
        
        function getLevelText(item){
            if(item.lt && item.gt){
                return item.gt+'~'+item.lt+''
            }else if(item.lt && !item.gt){
                return item.lt + '以下'
            }else if(!item.lt && item.gt){
                return item.gt + '以上'
            }
        }
        
    }
    function initMap(callback) {//初始化地图
        myGDMap && myGDMap.clearMap();
        $.get('../json/' + mapAreaCode+ '.json',function (res) {
            plynDatas = res.map(aoi => {
                var regEx = /\s+/g;
                var wkt = aoi.wkt.replace(regEx, ' ').split(',')
                aoi.wkt = wkt.map(pair => pair.split(' '))
                return aoi;
            });
            setMapPlyn(plynDatas);
            getPoints();
            callback && callback();
        })
    }
    function getPoints() {//获取地图点数据
        myGDMap.off('click')
        // var type = $('.tablist .tab_item.active').attr('data-maptype');
        var type="main"
        var subType = $('.tab_content_item [name="mapType"]:checked').val();
        var subTypeName = $('.tab_content_item [name="mapType"]:checked').siblings('.map_type_name').html();
        var params = {
            year:commonYear,
            aab301:mapAreaCode,
        }
        var mapUrl ={
            zbajs:"/zjax/admin/Djg/zfjgMapZbaj",
            ssjsjccs:"/zjax/admin/Djg/zfjgMapZSsj"
        };
        $$.ajaxRequest(ajaxUrl + mapUrl[subType],params,function (res) {
            setPoints(res.data,type,subType,subTypeName);
        });
        // res = {"data":[
        //     {"aab301":"330100","ctname":"杭州市","lng":"119.553580","lat":"30.025000","value":88.37},
        //     {"aab301":"330200","ctname":"宁波市","lng":"121.509789","lat":"29.868387","value":62.77},
        //     {"aab301":"330300","ctname":"温州市","lng":"120.602112","lat":"27.900574","value":89.19},
        //     {"aab301":"330400","ctname":"嘉兴市","lng":"120.750862","lat":"30.762653","value":80.52},
        //     {"aab301":"330500","ctname":"湖州市","lng":"119.952420","lat":"30.879381","value":93.52},
        //     {"aab301":"330600","ctname":"绍兴市","lng":"120.582115","lat":"29.907116","value":80.75},
        //     {"aab301":"330700","ctname":"金华市","lng":"119.989506","lat":"29.129523","value":90.12},
        //     {"aab301":"330800","ctname":"衢州市","lng":"118.722627","lat":"28.991708","value":79.68},
        //     {"aab301":"330900","ctname":"舟山市","lng":"122.106865","lat":"30.016027","value":92.08},
        //     {"aab301":"331000","ctname":"台州市","lng":"121.108596","lat":"28.901379","value":88.59},
        //     {"aab301":"331100","ctname":"丽水市","lng":"119.321783","lat":"28.151994","value":87.76},
        //     {"aab301":"330000","ctname":"浙江省","lng":"120.153580","lat":"30.287458","value":84}
        // ],"state":"ok"};
        // setPoints(res.data,type,subType,subTypeName);
    }
    function alertMaptable(title,aab301,subType){
        if(subType=="zbajs"){//在办案件数
            $$.alertTable({
                title: title+'  ',
                colsData: [[
                    { type: 'numbers', title: '序号' },
                {title: "案件名称", field: "ajname"},
                {title: "案件编号", field: "abb016"},
                {title: "登记日期", field: "abb277"},
                {title: "主办监察员", field: "abb010t"},
                {title: "协办监察员", field: "abb011t"},
                {title: "所属辖区", field: "aab301s"},
                {title: "当前状态", field: "bb1004"}
                ]],
                url: ajaxUrl + '/zjax/admin/Djg/zfjglefttoplist',
                where: {
                    type:"jcaj",
                    bj:"0",
                    aab301:aab301||'',
                    year:commonYear,
                },
                pageProp: {
                    limit: 10
                },
                rowClickFun: function (obj) {
                    alertMapZBAJDetails(obj,aab301)
                }
            });
        }else if(subType=="ssjsjccs"){// 双随机检查次数
            $$.alertTable({
                title: title+'  ',
                colsData: [[
                    { type: 'numbers', title: '序号' },
                    {title: "企业统一信用代码", field: "unicode"},
                    {title: "任务", field: "taskcode"},
                    {title: "企业名称", field: "legalentityname"},
                    {title: "创建时间", field: "createtime"},
                    {title: "检查完成时间", field: "checkcompletetime"},
                ]],
                url: ajaxUrl + '/zjax/admin/Djg/zfjgMapZSsjList',
                where: {
                    year:commonYear,
                    aab301:aab301||''
                },
                pageProp: {
                    limit: 10
                },
                rowClickFun: function (obj) {
                    alertMapDetails(obj,aab301);//taskId 主键
                }
            });
        }
      
    }
  function  alertMapZBAJDetails(obj,aab301){
    var tableColumns = [
        [
            {title: "案件编号", field: "abb016"},
            {title: "基本诉求", field: "aba003"},
            {title: "基本案情", field: "abb012"},
            {title: "登记日期", field: "abb277"},
            {title: "主办监察员", field: "abb010t"},
            {title: "协办监察员", field: "abb011t"},
            {title: "案由", field: "aba002"},
            {title: "投诉人", field: "tsr"},
            {title: "被投诉人", field: "btsr"},
            {title: "案件名称", field: "ajname"},
            {title: "所属辖区", field: "aab301s"},
            {title: "当前状态", field: "bb1004"},
        ]
    ];
    var ecm = $$.alert('axzs');
    $('#' + ecm).html(`
        <div class="title">详情</div>
        <div class="table_con">
            <div class="model">
                <div class="model_title">基本信息</div>
                <div class="model_content ztxxTable"></div>
            </div>
           
        </div>
    `);
//     <div class="model czqk">
//     <div class="model_title">处置情况</div>
//     <div class="model_content jbqkTable"></div>
// </div>
    $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgjcajdetail',{
        id: obj.data.abz001,
        year:commonYear,
        aab301: aab301
    },function(res){
        var data = res.data ||　{};
        $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
        // if(data.yja011-0 == 2){
        //     $$.title2Table('#'+ecm+' .jbqkTable', tableColumns[2], data||{},2);
        // }else{
        //     $('#'+ecm+' .czqk').hide();
        // }
    });
  }
    function alertMapDetails(obj,aab301){
        var tableColumns = [
            [
                {title: "企业统一信用代码", field: "unicode"},
                {title: "任务", field: "taskcode"},
                {title: "企业名称", field: "legalentityname"},
                {title: "创建时间", field: "createtime"},
                {title: "检查完成时间", field: "checkcompletetime"}
            ]
        ];
        var ecm = $$.alert('axzs');
        $('#' + ecm).html(`
            <div class="title">详情</div>
            <div class="table_con">
                <div class="model">
                    <div class="model_title">基本信息</div>
                    <div class="model_content ztxxTable"></div>
                </div>
               
            </div>
        `);
    //     <div class="model czqk">
    //     <div class="model_title">处置情况</div>
    //     <div class="model_content jbqkTable"></div>
    // </div>
        $$.ajaxRequest(ajaxUrl + '/zjax/admin/Djg/zfjgMapZSsjDetail',{
            id: obj.data.taskid,
            year:commonYear,
            aab301: aab301
        },function(res){
            var data = res.data ||　{};
            $$.title2Table('#'+ecm+' .ztxxTable',tableColumns[0], data||{},2);
            // if(data.yja011-0 == 2){
            //     $$.title2Table('#'+ecm+' .jbqkTable', tableColumns[2], data||{},2);
            // }else{
            //     $('#'+ecm+' .czqk').hide();
            // }
        });
    }
    function setPoints(datas,type,subType,subTypeName,tableUrl) {//添加地图点
        datas = datas.filter(item => item.aab301 != mapAreaCode)
        $.each(datas, function (i, item) {
            var html = `<div class="map_text_con ${subType} ${(subType+'_'+item.aab301)} ${getPointClass(item.num,type,subType)}">
            <div class="effect_scatter">
                <div class="effect_circle circle"></div>
                <div class="effect_circle effect_circle1"></div>
                <div class="effect_circle effect_circle2"></div>
                <div class="effect_circle effect_circle3"></div>
            </div>
            <div class="area_box">
                <div class="text">${item.ctname}</div>
            </div>
            <div class="num_box num white">${item.num}</div>
            <div class="name_box">${subTypeName}</div>
        </div>`
                            // <span class="map_unit">万人</span>
            // let html = '<div class="mapIcon mapIcon">' + item.value + '<span class="dw">' + item.ctname + '</span></div>';

            marker = new AMap.Marker({
                // position: new AMap.LngLat(item.lng-0, item.lat-0),
                // content: item.ctname,
                position: new AMap.LngLat(item.lng - 0, item.lat - 0),
                // 将 html 传给 content
                content: html,
                // 以 icon 的 [center bottom] 为原点
                offset: new AMap.Pixel(-18, -15),
                data: item
            });
            myGDMap.add(marker);
            AMap.event.addListener(marker, 'click', function (e) { //添加点击事件,传入对象名，事件名，回调函数
                iconClick(e.target.w.data,subType)
                 alertMaptable(subTypeName,e.target.w.data.aab301,subType)
                
               
            })
            if(subType == 'tjcgl'){
                AMap.event.addListener(marker, 'mouseover', function (e) { //添加点击事件,传入对象名，事件名，回调函数
                    $('.tjcgl_'+e.target.w.data.aab301 + ' .name_box').tips({
                        title:'调解成功率',
                        content:'调解成功案件数/劳动纠纷案件办结总数*100%'
                    },{
                        width:200,
                        position:'right',
                        trigger:'click',
                        class:'my_tooltip my_tooltip_r',
                        margin:0
                    })
                })
                
            }
        })
    }
  
    function getPointClass(value,type,subType){// 转换点样式
        var levelTypeClass = '';
        var levels = mapLevelSelects[type + '_' + subType];
        if(levels && levels.length>0){
            $.each(levels,function(i,item){
                if(item.lt && item.gt && (value<item.lt && value>=item.gt)){
                    levelTypeClass = 'map_text_con_'+item.class;
                }else if(item.lt && !item.gt && value<item.lt){
                    levelTypeClass = 'map_text_con_'+item.class;
                }else if(!item.lt && item.gt && value>=item.gt){
                    levelTypeClass =  'map_text_con_'+item.class;
                }
            });
        }
       
        return levelTypeClass;
    }
    function setMapPlyn(datas) {// 生成地图区块
        mapPlyns = [];
        $.each(datas, function (i, item) {
            // var index = plynDatas.map(item=>item.aoiid).indexOf(item.aab301);
            // if(index > -1){
            plynItem = item;
            plynItem.areaCode = item.aoiid;
            plyn = new AMap.Polygon({
                bubble: true,
                fillOpacity: 0.8,
                fillColor: mapColor.normal,//填充颜色
                strokeColor:'#8BB3E3',//轮廓线
                strokeWeight: .1,
                path: plynItem.wkt,
                map: myGDMap,
                data: plynItem,
                cont: [plynItem.x, plynItem.y]
            })
            // }
            mapPlyns.push(plyn);
            AMap.event.addListener(plyn, 'click', function (e) { //添加点击事件,传入对象名，事件名，回调函数
                areaClick(e.target.w.data, e.target.w.cont, e)
                setModelMain(true)
            })
        });
        myGDMap.off('zoomchange').on('zoomchange', function (e,b,c) {
            //TODO: 监听地图缩放
            if(isMapClick){// 下钻，切换区县
                isMapClick = false;
                return;
            }else{
                var zoom = myGDMap.getZoom();
                if(mapLastZoom != zoom){//避免重复触发
                    mapLastZoom = zoom;
                    var mouseMapArea = '';
                    if(mouseLnglat){// 判断鼠标当前在那个地区
                        $.each(mapPlyns,function(i,plynItem){
                            if(plynItem.contains(mouseLnglat)){
                                mouseMapArea = plynItem.w.data;
                                plynItem.setOptions({
                                    fillColor: mapColor.active
                                })
                            }else{
                                plynItem.setOptions({
                                    fillColor: mapColor.normal
                                })
                            }
                        })
                    }
                    var mapLevel = getAreaLevel(mouseMapArea.aoiid);
                    if (zoom == 8) {
                        mapAreaCode = '330000';
                        myGDMap.setCenter( [120.153576,29.289523])
                        $('.map_tit .loc').eq(0).nextAll().remove();
                        changeModel();
                    } else if (zoom == 9) {
                        var areacode,center;
                        if (mapLevel == 2){//当前为区县，缩小
                            areacode = $('.map_tit .loc').eq(1).attr('data-i');
                            center = ($('.map_tit .loc').eq(1).attr('data-lnglat')).split(',');
                            $('.map_tit .loc').eq(1).nextAll().remove();
                            mapAreaCode = areacode;
                            myGDMap.setCenter(center);
                            changeModel(true);
                        }else{//放大
                            if(mouseMapArea && mapAreaCode != mouseMapArea.aoiid){
                                areacode = mouseMapArea.aoiid;
                                center = [mouseMapArea.x,mouseMapArea.y];
                                $('.map_tit').append('<span  data-i="'+areacode+'" data-lnglat="'+(center.join(','))+'"   class="loc" >  '+mouseMapArea.name+'</span>')
                                mapAreaCode = areacode;
                                myGDMap.setCenter(center);
                                var type = $('.tablist .tab_item.active').attr('data-maptype');
                                changeModel(type == 'lhyg');
                            }
                        }
                    }else if (zoom == 11){
                        areacode = mouseMapArea.aoiid;
                        center = [mouseMapArea.x,mouseMapArea.y];
                        mapAreaCode = areacode;
                        if($('.map_tit .loc').length>=3 ){//区县，不增加
                            $('.map_tit .loc').eq(2).attr('data-i',areacode);
                            $('.map_tit .loc').eq(2).attr('data-lnglat',center.join(','));
                            $('.map_tit .loc').eq(2).html(' '+mouseMapArea.name);
                        }else{
                            $('.map_tit').append('<span  data-i="'+areacode+'" data-lnglat="'+(center.join(','))+'"   class="loc">  '+mouseMapArea.name+'</span>')
                        }
                        myGDMap.setCenter(center);
                        changeModel(true);
                    }
                }
            }
        });
    }
    
    function areaClick(data, cont, ev) {
        //TODO: 地区点击事件
        isMapClick = true;
        $.each(mapPlyns,function(i,plyn){
            plyn.setOptions({
                fillColor: mapColor.normal
            })
        })
        mapActiveAreaData = data;
        var mapLevel = getAreaLevel(data.areaCode);
        var zoom = myGDMap.getZoom();
        ev.target.setOptions({
            fillColor: mapColor.active
        });
        var option = ev.target.getOptions();
        var type = $('.tablist .tab_item.active').attr('data-maptype');
        if(type == 'lhyg'){
            if (zoom >= 8 && zoom <= 20) {
                if (mapLevel == 1) {//市级
                    mapAreaCode = data.areaCode;
                    myGDMap.setZoomAndCenter(9, [data.x, data.y]);
                    if($('.map_tit .loc').length>=2 ){//区县，不增加
                        $('.map_tit .loc').eq(1).attr('data-i',mapAreaCode);
                        $('.map_tit .loc').eq(1).attr('data-lnglat',[data.x, data.y].join(','));
                        $('.map_tit .loc').eq(1).html(' '+data.name);
                    }else{
                        $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"   class="loc">  '+data.name+'</span>')
                    }
                    setModelMain(true);
                } 
            }
        }else{
            if (zoom >= 8 && zoom <= 20) {
                if (mapLevel == 1) {//市级
                    mapAreaCode = data.areaCode;
                    myGDMap.setZoomAndCenter(9, [data.x, data.y])
                    $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"  class="loc">  '+data.name+'</span>')
                    setModelMain();
                } else if (mapLevel == 2) {//区县
                    if(mapAreaCode == data.areaCode){
                        if(isMapScale ){// 第二次点击，放大
                            isMapScale = false;
                            myGDMap.setZoomAndCenter(11, [data.x, data.y]);
                        }else{// 第二次点击，缩小
                            isMapScale = true;
                            myGDMap.setZoomAndCenter(9, [data.x, data.y]);
                            ev.target.setOptions({
                                fillColor: mapColor.normal
                            });
                            // $('.map_tit .loc').eq(1).nextAll().remove();
                        }
                    }else{//首次点击，切换数据
                        mapAreaCode = data.areaCode;
                        isMapScale = true;
                        if($('.map_tit .loc').length>=3 ){//区县，不增加
                            $('.map_tit .loc').eq(2).attr('data-i',mapAreaCode);
                            $('.map_tit .loc').eq(2).attr('data-lnglat',[data.x, data.y].join(','));
                            $('.map_tit .loc').eq(2).html(' '+data.name);
                        }else{
                            $('.map_tit').append('<span  data-i="'+mapAreaCode+'" data-lnglat="'+([data.x, data.y].join(','))+'"   class="loc">  '+data.name+'</span>')
                        }
                        mapAreaCode = data.areaCode;
                        myGDMap.setZoomAndCenter(9, [data.x, data.y])
                        setModelMain(true);;
                    }
                }
            }
        }
        
    }
    
    function iconClick(data,type) {//地区点击事件
      

    }

    function getAreaLevel(areaCode) {//获取地图层级
        areaCode += "";
        if (areaCode.length > 6) {
            return 3;
        } else if (areaCode.length == 6) {
            if (areaCode.substr(2) == "0000") {
                return 0;
            } else if (areaCode.substr(4) == "00") {
                return 1;
            } else {
                return 2;
            }
        }
    }
  
  
   
    /** 以下为弹窗 */
   
    //TODO: 以下为新二级页面
    function setNewPageAreaSelect(id,datas,modelClass){
        var html = ''
        $.each(datas,function(i,item){
            html += `<div class="select_item" data-areacode="${ item.value }">${ item.label }</div>`
        });
        $(id+' .select_con').html(html);
        $(id+' .select_con .select_item').eq(0).addClass('active');
        $(id+' .select_con .select_item').off('click').click(function(){
            $(this).addClass('active').siblings().removeClass('active');
            mapAreaCode = $(this).attr('data-areacode');
            changePage(false,modelClass);
        })
    }
   
})